#!/bin/bash
# 生产版本快速启动脚本

echo "启动轴承监控生产系统..."
cd /home/pi/data_box_3_v0

# 激活虚拟环境
source production_env/bin/activate

# 创建目录
mkdir -p recordings test_photos logs test_data

# 检查端口
if netstat -tuln | grep :5006 >/dev/null 2>&1; then
    echo "清理端口5006..."
    pkill -f "web_bearing_monitor"
    sleep 2
fi

# 设置环境
export PYTHONPATH="$PYTHONPATH:$(pwd)"
export FLASK_ENV=production

echo "系统启动中..."
echo "访问地址: http://192.168.1.5:5006"

# 启动系统
python web_bearing_monitor_production.py